#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

#include <ObjIdentify.h>
#include <Ice/Ice.h>
#include <opencv2/opencv.hpp>
#include "iceclient.h"
#include "workthread.h"
#include <QTime>
#include <QTimer>
#include <QMap>
#include <QtXml>
#include <QFile>
#include <QTextCodec>
#include <QDomDocument>




namespace Ui {
class MainWindow;
}



class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();


    void ImgToRow(string imgfilepath, Row &img_Row);
    QStringList getFileNames(const QString &path);
    void showMsg(QString msg, int num);
    int getProcessType();
    ComputingPlatform getComputingPlatform();
    void on_pbOpenDir_clicked_bak();
    QImage cvMat2QImage(const cv::Mat& mat, bool clone = true, bool rb_swap = true);
    cv::Mat QImage2cvMat(QImage &image, bool clone = false, bool rb_swap = true);

private slots:
    void on_tbMaxWindows_clicked();
    void on_tbMixWindows_clicked();
    void on_close_clicked();
    void on_pbOpenDir_clicked();
    void showResult(QString res, QString threadName);
    void showTime();
    void readXml(QString xmlPath);

    void on_OpenVideo_clicked();

    void on_pbStopWorkThread_clicked();

    void on_pbContinueWorkThread_clicked();

    void on_pbPauseWorkThread_clicked();
    void checkrb(bool);

    void on_pbClearView_clicked();

private:
    Ui::MainWindow *ui;
    int kModelWidth;
    int kModelHeight;
    int chn;
    int deviceID;


    WorkThread *workThread[4];
    QMap<QString,QString> map;
    VideoCapture capture[4];
    QString videoFile[4];
    QTime time;
    QTimer *timer;

    QMap<QString, QString> platformFunction;

signals:
    void sendFlagToWorkThread(bool,int,QString);
};

#endif // MAINWINDOW_H
